<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0,viewport-fit=cover">
    <!-- 相对根目录 -->
    <%
      var RELATIVE_ROOT = htmlWebpackPlugin.options.RELATIVE_ROOT,config =  htmlWebpackPlugin.options.config;
      //根据入口名，解析相对路径
      var chunkName = htmlWebpackPlugin.options.chunks[0];
      var paths = chunkName.split('/');
      var file_relative = './';
      while(paths.length >1){
        file_relative += '../';
        paths.pop();
      }
      file_relative += 'assets/';
    %>
    <!-- h5plus支持 -->
    <script src="html5plus://ready"></script>
    <!-- 通用文件 -->
    <script type="text/javascript" src="<%=RELATIVE_ROOT %>/static/js/include.js" include="<%=config.include.join(',')%>"></script>
    <!-- 自定义样式 -->
    <%
      (config.files.css || []).forEach(function(file){
    %>
    <link href="<%=file %>" rel="stylesheet">
    <% }) %>
    <!-- 样式 -->
    <%
      for (var css in htmlWebpackPlugin.files.css) {
        var file = htmlWebpackPlugin.files.css[css];
        file = '.'+file.substring(file.lastIndexOf('/'),file.length);
    %>
    <link href="<%=file %>" rel="stylesheet">
    <% } %>
    <title><%=config.title%></title>
  </head>
  <body>
    <div id="app"></div>
    <!-- 自定义脚本 -->
    <%
        (config.files.js || []).forEach(function(file){
    %>
    <script type="text/javascript" src="<%=file %>"></script>
    <% }) %>

    <!-- 脚本 -->
    <% for (var js in htmlWebpackPlugin.files.js) {
      var file = htmlWebpackPlugin.files.js[js];
      file = '.'+file.substring(file.lastIndexOf('/'),file.length);
      %>
    <script type="text/javascript" src="<%=file %>"></script>
    <% } %>

  </body>
</html>
